<?php
include_once 'header_php.php';
$title='Informations BDE';
include_once 'header_html.php';


$nom = 'BDE'; //on veut afficher seulement les informations relatives au BDE
$stalk = new association($nom);
$info=$stalk->GetInfo($db);
?>
<div class="wrapper">
    <div class="container-fluid">
			
		
	<div class="span2"><ul class="nav nav-list"><li><a href="asso.php?nom=BDE"><i class="icon-chevron-left"></i> BDE</a></li></ul></div>
				<div class="span10">
				<!--Body content-->
					<div class="row-fluid">
						<h1 class ="span4" >
                                                    <?php
                                                        echo "Informations BDE";
                                                    ?>
                                                </h1>
						
						<div style="float:right;" class="span2 offset1 pull-right">
						<?php 
                                                    echo' <img src=".'.$info['logo'].'">'; //On affiche le logo de l'asso
						?>
                                                </div>
					</div>
                                
                                <div>
                                <ul class="nav nav-tabs" id="myTab" data-tabs="tabs">
                                    <li class="active" ><a href="#cotisants" data-toggle="tab">Liste des cotisants</a></li>
                                    <li><a href="#valid" data-toggle="tab">Validation de réservations</a></li>
                                    <li><a href="#resa" data-toggle="tab">Validation de cotisations</a></li>
                                </ul>
                                <div class="tab-content">
                                
                                <div class="tab-pane active" id="cotisants" onClick="$('#myTab a[href=\"#cotisants\"]').tab('show');">
                                    <h2>Cotisants validés</h2>
                                    <table class="table table-striped">
                                        <thead>
                                        <tr>
                                            <th>Nom</th>
                                            <th>Prénom</th>
                                            <th>Login</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                <?php

                                $sql = "SELECT nom,prenom,login FROM cotisation C,personne P WHERE C.validee=1 AND C.annee=cast(substring(cast(CURRENT_DATE as varchar),1,4) as integer) AND C.personne=P.login;";
                                $query= new DbQuery($db,$sql);
                                $query->SendQuery();
                                while($result=$query->GetResult()){
                                    echo '<tr>';
                                    echo "<td><a href=\"profil.php?login=".$result['login']."\">".$result['nom']."</a></td>";
                                    echo "<td><a href=\"profil.php?login=".$result['login']."\">".$result['prenom']."</a></td>";
                                    echo "<td><a href=\"profil.php?login=".$result['login']."\">".$result['login']."</a></td>";
                                    echo "</tr>";

                                    }

                                ?>

                                        </tbody>
                                </table>
                            </div>
                                    <div class="tab-pane" id="valid" onClick="$('#myTab a[href=\"#valid\"]').tab('show');">
					<h2>Salles en demande de réservation</h2>
                                        <?php 
                                                
                                                echo'<table class="table table-striped">';
                                                            echo'<thead>';
								echo'<tr>';
                                                                    echo '<th>Association</th><th>Fonction</th><th>Salle</th><th>Date début</th><th>Date fin</th><th>Valider</th><th>Annuler</th>';
								echo'</tr>';
                                                            echo'</thead>';
                                                            echo '<tbody>';
                                                            $sql='SELECT * FROM reservation WHERE validee=0;';
                                                            $querySal= new DbQuery($db,$sql);
                                                            $querySal->SendQuery();
                                                            while($result=$querySal->GetResult()){
                                                                        echo '<tr>';
                                                                        echo '<td>'.$result['association'].'</td>';
                                                                        echo '<td>'.$result['fonction'].'</td>';
                                                                        echo '<td>'.$result['salle'].'</td>';
                                                                        echo '<td>'.$result['datedebut'].'</td>';
                                                                        echo '<td>'.$result['datefin'].'</td>';
                                                                        echo '<td><a href="traitement_resa.php?num='.$result['numreservation'].'&action=1"<i class="icon-ok"></i></a></td>';
                                                                        echo '<td><a href="traitement_resa.php?num='.$result['numreservation'].'&action=0"<i class="icon-remove"></i></a></td>';
                                                                        echo '</tr>';
                                                            }
                                                      
                                                            echo  '</tbody>';
                                                echo '</table>';
                                        ?>
                                    </div>
                                    <div class="tab-pane" id="resa" onClick="$('#myTab a[href=\"#resa\"]').tab('show');">
					<h2>Cotisations en attente de validation</h2>
                                        <?php 
                                                
                                                echo'<table class="table table-striped">';
                                                            echo'<thead>';
								echo'<tr>';
                                                                    echo '<th>Login</th><th>Année demandée</th><th>Valider</th><th>Annuler</th>';
								echo'</tr>';
                                                            echo'</thead>';
                                                            echo '<tbody>';
                                                            $sql='SELECT * FROM cotisation WHERE validee=0;';
                                                            $queryCot= new DbQuery($db,$sql);
                                                            $queryCot->SendQuery();
                                                            while($result=$queryCot->GetResult()){
                                                                        echo '<tr>';
                                                                        echo '<td>'.$result['personne'].'</td>';
                                                                        echo '<td>'.$result['annee'].'</td>';
                                                                        echo '<td><a href="traitement_cotis.php?pers='.$result['personne'].'&annee='.$result['annee'].'&action=1"><span style="background-image:url(img/glyphicons-halflings.png);background-position:-280px 0;width:12px;height:12px;">       </span></a></td>';
                                                                        echo '<td><a href="traitement_cotis.php?pers='.$result['personne'].'&annee='.$result['annee'].'&action=0"><i class="icon-remove"></i></a></td>';
                                                                        echo '</tr>';
                                                            }                                                      
                                                            echo  '</tbody>';
                                                echo '</table>';
                                        ?>
                                        
                                </div>        
                                </div>
    </div>
</div><!-- /container -->
</div></div>

<?php include_once 'footer.php'; ?>
